﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
//using static SmartWeighMonitor.Utils.VideoPlayUtil;

namespace SmartWeighMonitor.Windows
{
    /// <summary>
    /// VideoWindow.xaml 的交互逻辑
    /// </summary>
    public partial class VideoWindow : Window
    {
        System.Windows.Forms.PictureBox m_pictureBox01;
        private int m_nPlayHandle01 = 0;
        //FullScreenInContainerHelper fullScreenInContainer;
        ImageSource video_url = null;
        public VideoWindow()
        {
            InitializeComponent();
            this.Loaded += VideoWindow_Loaded;
        }

        private void VideoWindow_Loaded(object sender, RoutedEventArgs e)
        {
            billImage.Source = video_url;
        }

        //private void payVideo(int idx, System.Windows.Forms.PictureBox picBox, String[] info)
        //{
        //    string ip = info[0];
        //    short nPort = Int16.Parse(info[1]);
        //    string username = info[2];
        //    string pass = info[3];

        //    int handle = 0;
        //    handle = VzClientSDK.VzLPRClient_Open(ip, (ushort)nPort, username, pass);
        //    if (handle == 0)
        //    {
        //        return;
        //    }
        //    VzClientSDK.VzLPRClient_SetIsShowPlateRect(handle, 0);
        //    picBox.Image = null;
        //    if (idx == 1)
        //    {
        //        if (m_nPlayHandle01 > 0)
        //        {
        //            VzClientSDK.VzLPRClient_StopRealPlay(m_nPlayHandle01);
        //            m_nPlayHandle01 = 0;
        //        }
        //    }
        //    VzClientSDK.VzLPRClient_SetVideoVBR(handle, 5);
        //    int lprHandle1 = 0;
        //    if (picBox.Tag != null)
        //    {
        //        string sHandle = picBox.Tag.ToString();
        //        lprHandle1 = Int32.Parse(sHandle);
        //    }
        //    if (lprHandle1 > 0)
        //    {
        //        VzClientSDK.VzLPRClient_SetPlateInfoCallBack(lprHandle1, null, IntPtr.Zero, 0);
        //    }
        //    if (idx == 1)
        //    {
        //        m_nPlayHandle01 = VzClientSDK.VzLPRClient_StartRealPlay(handle, picBox.Handle);
        //        picBox.Tag = handle;
        //    }
          
        //}

        public void getVideoUrl(ImageSource url)
        {
            this.video_url = url;
        }
        private void Image_OnMouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.ChangedButton == MouseButton.Left && e.ClickCount == 2)
            {
               this.Close();
            }

        }

        //private void ImageOpen(object sender, MouseWheelEventArgs e)
        //{
        //    TransformGroup transformGroup = (TransformGroup)billImage.RenderTransform;
        //    ScaleTransform transform = (ScaleTransform)transformGroup.Children[0];

        //    double zoom = e.Delta > 0 ? .2 : -.2;
        //    transform.ScaleX += zoom;
        //    transform.ScaleY += zoom;
        //}
    }
}
